#!/usr/bin/env python

from mxit import handles
from mxit import encryption
from mxit import errors
from blend import constants


class listener:

   def __init__(self,blend):
      self.blend = blend;
      
   def buddy_updated(self,buddy,presence=None,mood=None,name=None,group=None,old_presence=None):
      if presence != None:
         self.blend.gui.tray.refreshIMSubmenu();

   def buddy_added(self,buddy):
      self.blend.gui.tray.refreshIMSubmenu();
      
   def status_changed(self,status,reason):
      if status == handles.Status.ACTIVE:
         pres = handles.Presence.AVAILABLE;
         self.blend.gui.tray.changePresence(constants.C.presences[pres]);
      else:
         pres = handles.Presence.OFFLINE;
         self.blend.gui.tray.changePresence(constants.C.presences[pres]);         
